using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Deepcode.Flux.Core.Systems.Workflow;
using Deepcode.Flux.Core.Systems.Workflow.Bases;

public partial class Public_ScheduleTasks_Workflow : System.Web.UI.Page
{
	protected void Page_Load(object sender, EventArgs e)
	{
		Task [] SystemTasks = new Tasks().GetSystemTasksExpired();
		foreach (Task SystemTask in SystemTasks)
		{
			TaskExitPath [] paths = SystemTask.ExitPaths;
			if( (paths != null) && (paths.Length == 1)   )
			{
				// The exit path to process is at index position [0] so - Process it
				WorkflowEngine engine = new WorkflowEngine( SystemTask.HandlerCodeID );
				if (engine != null)
					engine.ProcessExitAction( SystemTask.PK_ID, paths[0].PK_ID );
			}
		}
	}
}
